///*
// * File:   Timer.cpp
// * Author: ejordan
// *
// * Created on March 21, 2013, 10:53 PM
// */
//
//#include <p32xxxx.h>
//#include <plib.h>
//#include "Timer.h"
//
//// Have to declare static members so they are aviliable
//std::vector<Timer> Timer::_timers;
//
//void Timer::Initialize(Timer::Timers timer, UINT32 preScale, UINT32 period, void (*onTick)())
//{
//	this->_onTick = onTick;
//
//	switch (timer)
//	{
//		case Timer::Timers::Core:
//			OpenCoreTimer(period);
//			break;
//		case Timer::Timers::Timer1:
//			CloseTimer1();
//			WriteTimer1(0);
//			INTClearFlag(INT_T1);
//			ConfigIntTimer1(T1_INT_ON | T1_INT_PRIOR_2 | T1_INT_SUB_PRIOR_0);
//			OpenTimer1(T1_ON | T1_IDLE_CON | T1_TMWDIS_OFF | T1_GATE_OFF | preScale | T1_SYNC_EXT_OFF | T1_SOURCE_INT, period);
//			break;
//		case Timer::Timers::Timer2:
//			OpenTimer2(T2_ON | T2_IDLE_CON | T2_GATE_OFF | preScale | T2_32BIT_MODE_OFF | T2_SOURCE_INT, period);
//			break;
//		case Timer::Timers::Timer23:
//			OpenTimer23(T23_ON | T23_IDLE_CON | T23_GATE_OFF | preScale | T23_32BIT_MODE_ON | T23_SOURCE_INT, period);
//			break;
//		case Timer::Timers::Timer3:
//			OpenTimer3(T3_ON | T3_IDLE_CON | T3_GATE_OFF | preScale | T3_SOURCE_INT, period);
//			break;
//		case Timer::Timers::Timer4:
//			OpenTimer4(T4_ON | T4_IDLE_CON | T4_GATE_OFF | preScale | T4_32BIT_MODE_OFF | T4_SOURCE_INT, period);
//			break;
//		case Timer::Timers::Timer45:
//			OpenTimer45(T45_ON | T45_IDLE_CON | T45_GATE_OFF | preScale | T45_32BIT_MODE_ON | T45_SOURCE_INT, period);
//			break;
//		case Timer::Timers::Timer5:
//			OpenTimer5(T5_ON | T5_IDLE_CON | T5_GATE_OFF | preScale | T5_SOURCE_INT, period);
//			break;
//	}
//
//	return;
//}
//
//Timer::Timer(Timer::Timers timer, UINT32 preScale, UINT32 period, void (*onTick)())
//{
//	this->Initialize(timer, preScale, period, onTick);
//}
//
//Timer::~Timer() { }
//
//Timer Timer::GetTimer(float period, void (*onTick)()) { }
//
//Timer Timer::GetTimer(UINT32 preScale, UINT32 period, void (*onTick)()) { }
//
///*! \brief Timer 1 Tick
// */
//extern "C"
//void __ISR(_TIMER_1_VECTOR, ipl2) Timer1_OnTick(void)
//{
//	// clear the interrupt flag
//	INTClearFlag(INT_T1);
//	WriteTimer1(0);
//	PORTToggleBits(IOPORT_A, BIT_0);
//
//}
